//
//  ViewController.m
//  myQRDemo
//
//  Created by yorkfeng on 15/12/25.
//  Copyright © 2015年 yorkfeng. All rights reserved.
//

#import "ViewController.h"
#import "ScanViewController.h"

#define SCREEN_WIDTH    [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT   [UIScreen mainScreen].bounds.size.height
#define BUTTON_X        ((SCREEN_WIDTH-100)/2)
#define BUTTON_Y        ((SCREEN_HEIGHT-100)/2)

@interface ViewController () {
    UIButton *scanBtn;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    scanBtn = [[UIButton alloc] initWithFrame:CGRectMake(BUTTON_X, BUTTON_Y, 100, 100)];
    [scanBtn setBackgroundImage:[UIImage imageNamed:@"icon"] forState:UIControlStateNormal];
    [scanBtn addTarget:self action:@selector(scanBtn_Touch:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:scanBtn];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)scanBtn_Touch:(id)sender {
    ScanViewController *target = [[ScanViewController alloc] init];
    //[self presentViewController:target animated:YES completion:nil];
    [self.navigationController pushViewController:target animated:YES];
//    NSLog(@"efewfew");
    
}

@end
